package cn.ad.server.web.spring.model.adview;

import cn.ad.server.domain.enumration.Connection;

import java.util.HashMap;
import java.util.Map;

/**
 * @author dongbin.yu
 * @from 2016-08-12
 * @since V1.0
 */
public enum AdViewConnection {


    UNKNOWN(Device.CONNECTION_TYPE.UNKNOWN, Connection.UNKNOWN),
    LAN(Device.CONNECTION_TYPE.LAN, Connection.UNKNOWN),
    WIFI(Device.CONNECTION_TYPE.WIFI, Connection.WIFI),
    CELLULAR_NETWORKS_UNKNOWN(Device.CONNECTION_TYPE.CELLULAR_NETWORKS_UNKNOWN, Connection.UNKNOWN),
    CELLULAR_NETWORKS_2G(Device.CONNECTION_TYPE.CELLULAR_NETWORKS_2G, Connection.NET2G),
    CELLULAR_NETWORKS_3G(Device.CONNECTION_TYPE.CELLULAR_NETWORKS_3G, Connection.NET3G),
    CELLULAR_NETWORKS_4G(Device.CONNECTION_TYPE.CELLULAR_NETWORKS_4G, Connection.NET4G);

    private Device.CONNECTION_TYPE connectionType;
    private Connection connection;

    public final static Map<Device.CONNECTION_TYPE, Connection> adViewConnectionMap = new HashMap<>();

    static {
        for (AdViewConnection adViewConnection : AdViewConnection.values()) {
            adViewConnectionMap.put(adViewConnection.connectionType, adViewConnection.connection);
        }
    }

    AdViewConnection(Device.CONNECTION_TYPE connectionType, Connection connection) {
        this.connectionType = connectionType;
        this.connection = connection;
    }
}
